<%@ page language="java" pageEncoding="utf-8"%>

<!--/*** CSS样式 **/-->
<link rel="stylesheet" href="/jn-report/resources/paramquery-pro/pqgrid.min.css">
<link rel="stylesheet" href="/jn-report/resources/paramquery-pro/pqgrid.ui.min.css">
<link rel="stylesheet" href="/jn-report/resources/paramquery-pro/themes/steelblue/pqgrid.css">
<!--/*** JS脚本 **/-->
<script src="/jn-report/resources/paramquery-pro/pqgrid.min.js" type="text/javascript"></script>
<script src="/jn-report/resources/FileSaver/FileSaver.min.js" type="text/javascript"></script>
<script src="/jn-report/js/com/pgrid.js" type="text/javascript"></script>


<!--/*** 控件HTML标签 **/-->
<div class="col-md-9" style="margin-bottom: 25px;">
    <table id="pqGrid"></table>
</div>


<!--/*** pqGrid初始化事件 **/-->
<script>
    function initGrid(colM) {
        if (colM == 'undefined') colM = [];
        var data = {};
        data.grid = {
            iniDataListGrid: function () {
                var $grid = $('#pqGrid');
                var objo = {
                    width: (winWidth-300),
                    height: '820',
                    postRenderInterval: -1, //synchronous post rendering.
                    showTitle: true,
                    title: "",
                    resizable: true,
                    hwrap: false,
                    wrap: false,
                    dragColumns: {enabled: false},
                    numberCell: {
                        show: false,
                        width: 50
                    },
                    // bootstrap: { on : true },
                    showBottom: false,
                    showTop: true,
                    showToolbar: true,
                    virtualY: true,
                    //selectionModel: {
                    //  type: 'row',
                    //  mode: 'block'
                    //},
                    hoverMode: 'row',
                    toolbar: {
                        items: [
                            {
                                type: 'button',
                                width: 150,
                                label: "导出Excel",
                                icon: 'ion-ios-download-outline',
                                listener: function () {
                                    //var format = 'xls',
                                    //    blob = this.exportData({
                                    //        format: format,
                                    //        render: true
                                    //    });
                                    //if (typeof blob === "string") {
                                    //    blob = new Blob([blob]);
                                    //}
                                    var format = 'xlsx',
                                        blob = this.exportData({
                                            format: format,
                                            render: true,
                                            type: 'blob'
                                        });
                                    var excel_name = "Report_Excel.";
                                    if (this.options.title != null && this.options.title != "" && this.options.title != 'undefined'){
                                        excel_name = this.options.title + ".";
                                    }
                                    saveAs(blob, excel_name + format);
                                }
                            },{
                                type: "<span>共 0 条</span>",
                                width: 110
                            },
                        ]
                    },
                    scrollModel: {
                        autoFit: false
                    },
                    collapsible: {
                        on: false,
                        collapsed: false,
                        toggle: false,
                    },
                    colModel:colM
                };
                $grid.pqGrid(objo);
            }
        };
        data.grid.iniDataListGrid();
    };
    initGrid();
</script>